–– printOut (by Gary Bond, copyright Apple Computer, Inc 1988 - 1989)
–– dialog (by Gary Bond, copyright Apple Computer, Inc 1988 - 1989)
function scrollLineClicked theOffSet
return (round((the scroll of the target / the textHeight of the target) + (((the clickV - top of the target - theOffSet) div the textHeight of the target) + 1)))
end scrollLineClicked
function lineClicked
return ((the clickV - top of the target) div the textHeight of the target) + 1
end lineClicked
on closeCard
if the visible of bkgnd btn "mask" is "true" then findDialog
end closeCard
on beginSearch
global startCard, findWord, selectWord, beginning
put empty into beginning
put line 1 of bkgnd field "finder" into findWord
if (selectWord is not empty) OR (findWord is not empty) then
put the number of this card into startCard
put bkgnd field "finder" into findWord
lock screen
doFind
else select line 1 of bkgnd field "finder"
end beginSearch
on doFind
global startCard, numIndexs, findWord, counter, selectWord
global prevCard, prevScroll, beginning
set cursor to watch
if the number of this card > numIndexs then go next card
else go to card (numIndexs + 1)
find string findWord
if (the result is empty) then
if the number of this card > numIndexs then
if the number of this card is beginning then
go to card prevCard
set the scroll of bkgnd field "description" to prevScroll
unlock screen with wipe right
select selectWord
answer "Found all instances of" && "“" & findWord & "”." with "Search Again" or "Cancel"
if it is "Cancel" then
put empty into beginning
exit to HyperCard
else
put empty into beginning
lock screen
doFind
end if
end if
else
add 1 to counter
if counter > 2 then notFound
else doFind
end if
if beginning is empty then
put the number of this card into beginning
end if
else notFound
put the foundChunk into selectWord -- FOUND IT
put the number of this card into prevCard
put the scroll of bkgnd field "description" into prevScroll
put 0 into counter
unlock screen with wipe right
select selectWord
end doFind
on notFound
global startCard, selectWord, findWord, counter
go to card startCard
findDialog "open"
unlock screen
answer "“" & findWord & "”" && "was not found." with "OK"
select line 1 of bkgnd field "finder"
put 0 into counter
exit to HyperCard
end notFound
on returnKey
global findWord
if the visible of bkgnd btn "begin search" is true then
send mouseUp to bkgnd btn "begin search"
else
if (the selection is not empty) and (findWord is not empty) then
lock screen
doFind
else pass returnKey
end if
end returnKey
on findDialog what
global findWord, textInstr
lock screen
if what is not "open" then
hide bkgnd btn "mask"
hide bkgnd btn "mask1"
hide bkgnd btn "mask2"
hide bkgnd btn "mask3"
hide bkgnd btn "begin search"
hide bkgnd btn "Cancel"
hide bkgnd field "searchMe"
hide bkgnd field "finder"
hide bkgnd field "Instr"
unlock screen
put empty into bkgnd field "finder"
put empty into bkgnd field "Instr"
put empty into bkgnd field "searchMe"
else
show bkgnd btn "mask"
show bkgnd btn "mask1"
show bkgnd btn "mask2"
show bkgnd btn "mask3"
show bkgnd btn "begin search"
show bkgnd btn "Cancel"
show bkgnd field "searchMe"
show bkgnd field "finder"
show bkgnd field "Instr"
put "Click a word or phrase in the list or type an entry in" && "the field below." & return & "Then click the “Begin Search” button." & return & return & "Press the Return key to continue searching." into bkgnd field "Instr"
put findWord into bkgnd field "finder"
put bkgnd field 1 of first card into bkgnd field "searchMe"
unlock screen
end if
select line 1 of bkgnd field "finder"
end findDialog
on openStack
global numIndexs, findWord, resetBlindTyping
push recent card
pop card into whereIcameFrom
if the version < 1.2 then
answer "This stack requires HyperCard 1.2 or later."
go whereIcameFrom
exit to HyperCard
end if
hide menubar
put ((the number of cards in bkgnd "index") + 1) into numIndexs
if the blindTyping is "true" then
set blindTyping to "false"
put "true" into resetBlindTyping
end if
end openStack
on closeStack
global resetBlindTyping
push card
lock screen
go to first card
set the scroll of bkgnd field "categories" to 0
repeat for the number of cards in next bkgnd
go next card
set the scroll of bkgnd field "titles" to 0
end repeat
pop card
unlock screen
if resetBlindTyping is "true" then set blindTyping to "true"
end closeStack
on sort
answer "Sorting this stack would be destructive."
end sort
on domenu menu --// Added by Medior, Inc. 12/6/90
global RPStackName
if menu is in "Home,Quit HyperCard" and RPStackName is not "" then
set cursor to watch
put RPStackName into shortname
repeat until offset(":",shortname) = 0
delete char 1 to offset(":",shortname) of shortname
end repeat
delete last char of shortname
answer "This will return to "&shortname&"." with "Cancel" or "OK"